home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Info-Mac 4
/
Info_Mac IV CD-ROM (Pacific HiTech Inc.)(August 1994).iso
/
Text Processing
/
Pyramid
/
Pyramid.Pascal.Code
< prev
next >
Wrap
Text File
|
1994-05-16
|
1KB
|
65 lines
program pyramid;
{written by John Gray}
var
r: rect;
word, c: string[150];
x, y, z: integer;
Data: text;
procedure crunch;
var
k: integer;
v: integer;
begin
y := 0;
z := length(word);
for k := 1 to z do
begin
v := ord(word[k]);
case v of
0..47, 58..64, 91..96, 123..256:
v := 0;
end;
if (v >= 97) and (v <= 122) then
v := v - 96;
if (v >= 65) and (v <= 90) then
v := v - 64;
if (v >= 48) and (v <= 57) then
v := v - 48;
y := y + v;
end;
end;
procedure displaystuff;
begin
writeln('Input text. Enter "bye" to quit.');
writeln;
write('->');
readln(word);
crunch;
writeln('Total : ', y);
writeln(data, word, y);
writeln(data);
writeln;
if word <> 'bye' then
displaystuff;
end;
begin {main}
rewrite(Data, 'Data');
setrect(r, 20, 40, 500, 375);
settextrect(r);
showtext;
writeln('Pyramid, by John Gray. Compiled in THINK Pascal.');
writeln;
writeln('Enormous thanks to THINK technologies for programming the compiler. ');
writeln('Read the "Readme" file if you hope to understand this program at all…');
writeln;
writeln;
displaystuff;
writeln(Data, '----------------------------------------------');
close(Data);
end.